<?php
require_once 'application/constant/templatName.php';
require_once 'application/library/controller/gcLBasicAction.php';
require_once 'application/modules/user/services/user_services_changePswService.php';

/**
 * changePswController
 * @author    chenmeng
 * @version   1.0
 * @exclude   作  成  日：2011/04/07
 */
class user_changePswController extends gcLBasicAction{
    
    private  $objService;
    
    public function indexAction(){
        $this->initMenu("5");
        $this->boolUserTypeCheck("all");

        $strUserId = $this->getParam("UserId");
        $this->gcView->UserId = $strUserId;
//        $this->objService = new user_services_userViewService();
//        $arrUserInfo = $this->objService->pbGetUserInfoByUserId($strUserId);
//        $this->gcView->UserInfo = $arrUserInfo;
//        $this->gcView->adminIndex = true;
        $this->gcView->render("changePsw.tpl");
    }
    
    public function checkorgpswAction() {
        $strUserId = $this->getParam("UserId");
        $strOrgPsw = $this->getParam("orgPsw");
        
        $this->objService = new user_services_changePswService();
        $boolResult = $this->objService->pbCheckOrgPsw($strUserId, $strOrgPsw);
        if ($boolResult) {
            jsonHelper::outPutJson(true);
        } else {
            jsonHelper::outPutJson(false);
        }
    }
    
    public function updatepswAction() {
        $strUserId = $this->getParam("userId");
        $strOrgPsw = $this->getParam("orgPsw");
        $strNewPsw = $this->getParam("newPsw");
        
        $this->objService = new user_services_changePswService();
        $intCount = $this->objService->pbUpdatePsw($strUserId, $strOrgPsw, $strNewPsw);
        if ($intCount > 0) {
            jsonHelper::outPutJson(true);
        } else {
            jsonHelper::outPutJson(false);
        }
    }
    
    public function changecompleteAction() {
        $this->gcView->render("changePswComplete.tpl");
    }
}